<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Restricted Area</title>
</head>
<body>
<h1>Restricted Area</h1>
out.println("Go to <a href=\"logout.jsp\"> Logout</a>");
<%
	
	try { 
		 //String username = (String) session.getAttribute("username");
		 //String password = (String) session.getAttribute("password");
		 String username=null; 
		 String password=null;
		 String staticNum =null;
		 
		 Cookie[] cookies= request.getCookies();
		 for (int i =0; i<cookies.length; i++){
			 if (cookies[i].getName().equalsIgnoreCase("username")){
				 username=(String)cookies[i].getValue();
			 }else if (cookies[i].getName().equalsIgnoreCase("password")){
			 	password=(String) cookies[i].getValue();
			 }else if (cookies[i].getName().equalsIgnoreCase("staticNum")){
				 staticNum=(String) cookies[i].getValue();
			 }
		 }
		 
		 if (username==null && password == null){
			 out.println("You have not login!");
			 out.println("You can't see the secret.");
		 }else {
			 out.println("Hi " + username);
			 out.println("Your secret is ... "+password);
			 out.println("Your keypass is ... " + staticNum );
		 }
		 
	} catch (Exception e){
	
		
		out.println("Error.");
	}

%>


</body>
</html>